package com.guoyihao.oj.judge.codesandbox;

import com.guoyihao.oj.judge.codesandbox.model.ExecuteCodeRequest;
import com.guoyihao.oj.judge.codesandbox.model.ExecuteCodeResponse;
import lombok.extern.slf4j.Slf4j;

/**
 * 代码沙箱代理
 */
@Slf4j
public class CodeSandBoxProxy implements CodeSandBox{

    private CodeSandBox codeSandBox;

    /**
     * 构造方法注入
     * @param codeSandBox
     */
    public CodeSandBoxProxy(CodeSandBox codeSandBox){
        this.codeSandBox = codeSandBox;
    }

    /**
     * 执行代码
     * @param executeCodeRequest
     * @return
     */
    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
        //远程调用代码沙箱
        ExecuteCodeResponse executeCodeResponse = codeSandBox.executeCode(executeCodeRequest);
        //返回结果
        return executeCodeResponse;
    }

}
